/**
 * Copyright (c) 2009 Teoti Graphix, LLC See:
 *     http://tkarchitecture.teotigraphix.org
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 * @author Michael Schmalle mschmalle@teotigraphix.com
 */
package test.suite.dxframework.patterns.component
{

import mx.core.UIComponent;
import mx.styles.CSSStyleDeclaration;
import mx.styles.StyleManager;

import org.flexunit.Assert;
import org.fluint.uiImpersonation.UIImpersonator;
import org.teotigraphix.dx.core.ToolKitGlobals;
import org.teotigraphix.dx.interfaces.IBehaviorLayerAware;
import org.teotigraphix.dx.interfaces.ICoreBehaviorAware;
import org.teotigraphix.dx.interfaces.ICoreModelAware;
import org.teotigraphix.dx.interfaces.ICoreSkinAware;
import org.teotigraphix.dx.interfaces.IModelLayerAware;
import org.teotigraphix.dx.interfaces.ISkinAware;
import org.teotigraphix.dx.interfaces.ISkinLayerAware;
import org.teotigraphix.dx.interfaces.IToolKitComponent;
import org.teotigraphix.dx.interfaces.IToolKitFactoryAware;

import test.suite.dxframework.support.component.TestComponent;

public class TC_DXComponent_Container_Impls
{
	//--------------------------------------------------------------------------
	//
	//  Private :: Variables
	//
	//--------------------------------------------------------------------------
	
	/**
	 * @private
	 */
	private var component:TestComponent;
	
	/**
	 * @private
	 */
	//private var container:TestContainer;
	
	//--------------------------------------------------------------------------
	//
	//  Overridden Protected :: Methods
	//
	//--------------------------------------------------------------------------
	
	[Before(ui,async)]
	public function setUp():void
	{
		ToolKitGlobals.VALIDATION_EVENTS_ENABLED = true;
		component = new TestComponent();
		//container = new TestContainer();
		UIImpersonator.addChild( component );
		//UIImpersonator.addChild( container );
	}
	
	[After]
	public function tearDown():void
	{
		ToolKitGlobals.VALIDATION_EVENTS_ENABLED = false;
		UIImpersonator.removeChild( component );
		//UIImpersonator.removeChild( container );
	}
	
	[Test]
	/**
	 * Tests the <code>ToolKitComponent</code>'s implementations.
	 */
	public function test_DXComponent_implements():void
	{
		Assert.assertTrue( "!IToolKitComponent", (component is IToolKitComponent) );
		Assert.assertTrue( "!ICoreBehaviorAware", (component is ICoreBehaviorAware) );
		Assert.assertTrue( "!ICoreModelAware", (component is ICoreModelAware) );
		Assert.assertTrue( "!ICoreSkinAware", (component is ICoreSkinAware) );
		Assert.assertTrue( "!IToolKitFactoryAware", (component is IToolKitFactoryAware) );
		Assert.assertTrue( "!ISkinAware", (component is ISkinAware) );
		Assert.assertTrue( "!ISkinLayerAware", (component is ISkinLayerAware) );
		Assert.assertTrue( "!IBehaviorLayerAware", (component is IBehaviorLayerAware) );
		Assert.assertTrue( "!IModelLayerAware", (component is IModelLayerAware) );
	}
	
	[Test]
	/**
	 * Tests the <code>DXComponent</code>'s super.
	 */
	public function test_DXComponent_extends():void
	{
		Assert.assertTrue( "!UIComponent", (component is UIComponent) );
	}	
	
	[Test]
	/**
	 * Tests the <code>DXContainer</code>'s implementations.
	 */
	public function test_DXContainer_implements():void
	{
		/*
		assertTrue( "!IToolKitComponent", (container is IToolKitComponent) );
		assertTrue( "!ICoreBehaviorAware", (container is ICoreBehaviorAware) );
		assertTrue( "!ICoreServiceAware", (container is ICoreServiceAware) );
		assertTrue( "!IToolKitFactoryAware", (container is IToolKitFactoryAware) );
		assertTrue( "!ISkinAware", (component is ISkinAware) );	
		assertTrue( "!ISkinLayerAware", (container is ISkinLayerAware) );
		assertTrue( "!IBehaviorLayerAware", (container is IBehaviorLayerAware) );
		assertTrue( "!IServiceLayerAware", (container is IServiceLayerAware) );
		*/
	}
	
	[Test]
	/**
	 * Tests the <code>DXContainer</code>'s super.
	 */
	public function test_DXContainer_extends():void
	{
//		assertTrue( "!SkinnableContainer", (container is SkinnableContainer) );
	}
	
	[Tests]
	/**
	 * Tests the <code>DXComponent-Container</code>'s TypeSelector.
	 */
	public function test_DX_Component_Container_TypeSelector():void
	{
		var css:CSSStyleDeclaration;
		
		css = StyleManager.getStyleDeclaration(
			"org.teotigraphix.tk.core.ToolKitComponent");
		Assert.assertNotNull( "component TypeSelector not defined", css );
		css = StyleManager.getStyleDeclaration(
			"org.teotigraphix.tk.core.ToolKitContainer");
		Assert.assertNotNull( "container TypeSelector not defined", css );		
	}

}
}